package com.dondedesigns.eh.persistence.dao;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

import com.dondedesigns.eh.persistence.Permissions;

public class PermissionDAO extends GenericDAO<Permissions> {

	public boolean isRestrictedPage(String page) {
		Session s = (Session)getEntityManager().getDelegate();
		Permissions permission = (Permissions) s.createCriteria(Permissions.class)
			.add(Restrictions.eq("permission", page))
			.uniqueResult();
		return (permission != null);

	}

	public List<Permissions> select() {
		return super.select(Permissions.class);
		
	}

	public Permissions find(Long id) {
		return super.find(Permissions.class, id);
	}
	
}
